Optimal. Leaf size=80 \[ -\frac {a^2 (A-i B) \tan (c+d x)}{d}-\frac {2 a^2 (B+i A) \log (\cos (c+d x))}{d}+2 a^2 x (A-i B)+\frac {B (a+i a \tan (c+d x))^2}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.07, antiderivative size = 80, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.115, Rules used = {3527, 3477, 3475} \[ -\frac {a^2 (A-i B) \tan (c+d x)}{d}-\frac {2 a^2 (B+i A) \log (\cos (c+d x))}{d}+2 a^2 x (A-i B)+\frac {B (a+i a \tan (c+d x))^2}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3477
Rule 3527
Rubi steps
\begin {align*} \int (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=\frac {B (a+i a \tan (c+d x))^2}{2 d}-(-A+i B) \int (a+i a \tan (c+d x))^2 \, dx\\ &=2 a^2 (A-i B) x-\frac {a^2 (A-i B) \tan (c+d x)}{d}+\frac {B (a+i a \tan (c+d x))^2}{2 d}+\left (2 a^2 (i A+B)\right ) \int \tan (c+d x) \, dx\\ &=2 a^2 (A-i B) x-\frac {2 a^2 (i A+B) \log (\cos (c+d x))}{d}-\frac {a^2 (A-i B) \tan (c+d x)}{d}+\frac {B (a+i a \tan (c+d x))^2}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 2.58, size = 263, normalized size = 3.29 \[ \frac {a^2 \sec (c) \sec ^2(c+d x) (\cos (2 d x)+i \sin (2 d x)) \left (-8 (A-i B) \cos (c) \cos ^2(c+d x) \tan ^{-1}(\tan (3 c+d x))-i \left ((B+i A) \cos (c+2 d x) \left (4 d x-i \log \left (\cos ^2(c+d x)\right )\right )+2 \cos (c) \left ((A-i B) \log \left (\cos ^2(c+d x)\right )+4 i A d x+4 B d x-i B\right )-2 i A \sin (c+2 d x)+4 i A d x \cos (3 c+2 d x)+A \cos (3 c+2 d x) \log \left (\cos ^2(c+d x)\right )+2 i A \sin (c)-4 B \sin (c+2 d x)+4 B d x \cos (3 c+2 d x)-i B \cos (3 c+2 d x) \log \left (\cos ^2(c+d x)\right )+4 B \sin (c)\right )\right )}{4 d (\cos (d x)+i \sin (d x))^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.56, size = 125, normalized size = 1.56 \[ \frac {{\left (-2 i \, A - 6 \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-2 i \, A - 4 \, B\right )} a^{2} + {\left ({\left (-2 i \, A - 2 \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (-4 i \, A - 4 \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-2 i \, A - 2 \, B\right )} a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )}{d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.38, size = 215, normalized size = 2.69 \[ \frac {-2 i \, A a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 \, B a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 4 i \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 4 \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 i \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - 6 \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - 2 i \, A a^{2} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 \, B a^{2} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 i \, A a^{2} - 4 \, B a^{2}}{d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.02, size = 123, normalized size = 1.54 \[ -\frac {a^{2} B \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}-\frac {a^{2} A \tan \left (d x +c \right )}{d}+\frac {2 i a^{2} B \tan \left (d x +c \right )}{d}+\frac {i a^{2} A \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}+\frac {a^{2} B \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {2 i a^{2} B \arctan \left (\tan \left (d x +c \right )\right )}{d}+\frac {2 a^{2} A \arctan \left (\tan \left (d x +c \right )\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.84, size = 71, normalized size = 0.89 \[ -\frac {B a^{2} \tan \left (d x + c\right )^{2} - 4 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a^{2} - 2 \, {\left (i \, A + B\right )} a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (A - 2 i \, B\right )} a^{2} \tan \left (d x + c\right )}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.10, size = 76, normalized size = 0.95 \[ \frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (2\,B\,a^2+A\,a^2\,2{}\mathrm {i}\right )}{d}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (a^2\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}+B\,a^2\,1{}\mathrm {i}\right )}{d}-\frac {B\,a^2\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.61, size = 128, normalized size = 1.60 \[ - \frac {2 i a^{2} \left (A - i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {- 2 A a^{2} + 4 i B a^{2} + \left (- 2 A a^{2} e^{2 i c} + 6 i B a^{2} e^{2 i c}\right ) e^{2 i d x}}{- i d e^{4 i c} e^{4 i d x} - 2 i d e^{2 i c} e^{2 i d x} - i d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________